/*游戏树选择*/
function selectGameTree() {
    var treeId = $("#treeId").val();
    var gameId = $.common.isEmpty(treeId) ? "0" : $("#treeId").val();
    var url = ctx + "jl/game/selectGameTree/" + gameId;
    var options = {
        title: '选择游戏',
        width: "380",
        url: url,
        callBack: doSubmit
    };
    $.modal.openOptions(options);
}

function doSubmit(index, layero){
    var tree = layero.find("iframe")[0].contentWindow.$._tree;
    if ($.tree.notAllowParents(tree)) {
        var body = layer.getChildFrame('body', index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        layer.close(index);
    }
}

/* 通用状态显示 */
function statusTools(row) {
    if (row.status == 1) {// 停用状态,调用启用状态
        return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
    } else {// 启用,调用停用状态
        return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
    }
}

/* 通用状态启用 */
function enable(id) {
    $.modal.confirm("确认要启用玩家吗？", function() {
        $.operate.post(prefix + "/changeStatus", { "id": id, "status": 0 });
    })
}

/* 通用状态停用 */
function disable(id) {
    $.modal.confirm("确认要禁用玩家吗？", function() {
        $.operate.post(prefix + "/changeStatus", { "id": id, "status": 1 });
    })
}